import Vue from 'vue'
import Router from 'vue-router'
import Footer from '@/components/Footer'
Vue.use(Router)

export default new Router({
  mode: 'history',
  base: process.env.BASE_URL,
  routes: [
    { // 路由的重定向
      path: '/',
      redirect: '/home'
    },
    {
      path: '/home',
      name: 'home',
      components: {
        default: () => import('@/views/home/index.vue'), // 路由懒加载
        footer: Footer
      }
    },
    {
      path: '/cosmetics',
      name: 'cosmetics',
      components: {
        default: () => import('@/views/cosmetics/index.vue'), // 路由懒加载
        footer: Footer
      }
    },
    {
      path: '/skin',
      name: 'skin',
      components: {
        default: () => import('@/views/skin/index.vue'), // 路由懒加载
        footer: Footer
      }
    },
    {
      path: '/recommend',
      name: 'recommend',
      components: {
        default: () => import('@/views/recommend/index.vue'), // 路由懒加载
        footer: Footer
      }
    },
    {
      path: '/cart',
      name: 'cart',
      components: {
        default: () => import('@/views/cart/index.vue'), // 路由懒加载
        footer: Footer
      }
    },
    {
      path: '/shop',
      name: 'shop',
      components: {
        default: () => import('@/views/shop/index.vue'), // 路由懒加载
        footer: Footer
      }
    },
    {
      path: '/user',
      name: 'user',
      components: {
        default: () => import('@/views/user/index.vue'), // 路由懒加载
        footer: Footer
      }
    }
  ]
})
